package ThreadDemo2;

import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @Author Zhang Chao
 * @Date 2021/6/1 19:42
 * @Version 1.0
 */
public class TestDriver {
    public static void main(String[] args) {
        // 创建一个锁对象
        Lock lock = new ReentrantLock();
        //枷锁条件对象
        Condition condition = lock.newCondition();

        MyStack myStack = new MyStack(10, lock, condition);

        ProducerThread producerThread = new ProducerThread(myStack);
        producerThread.start();

        new Thread(new ConsumerThread(myStack)).start();

    }
}
